package cn.shadow.game.chess.CHnchess.type;

import java.util.HashMap;
import java.util.Map;

/**
 * 阵营方
 */
public enum Camp {
    BLACK("黑", 1), RED("红", 2);
    String name;
    int value;

    Camp(String name, int value) {
        this.name = name;
        this.value = value;
    }

    private final static Map<Integer, Camp> campMap = new HashMap<>();

    static {
        Camp[] values = Camp.values();
        for (Camp value : values) {
            campMap.put(value.value, value);
        }
    }

    public static Camp getCampByValue(int value) {
        return campMap.get(value);
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return value;
    }}
